package Opration;

import Book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("归还图书");
        System.out.println("请输入你想要归还的图书的书名：");
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getUseSized(); i++) {
            if(bookList.books[i].getName().equals(name)){
                System.out.println("找到了你要还的书");
                System.out.println(bookList.books[i]);
                bookList.books[i].setBorrow(false);
                return;
            }
        }
        System.out.println("没有你要还的书");
    }
}
